package deepr.controller;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.google.gson.Gson;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

import java.lang.reflect.Type;
import java.util.HashMap;
import java.util.Map;

@Controller
@Slf4j
public class DeeprController {

    @ResponseBody
    @PostMapping(value = "/api/v1/deepr/list", produces = "application/json;charset=UTF-8")
    public String list(String params) {
        log.info("deepr list, params:{}", params);
        Gson g = new Gson();
        HashMap p = g.fromJson(params, HashMap.class);
//        HashMap<String, Object> p = JSON.parseObject(params, HashMap.class);
        log.info("deepr list, p:{}", p);
        return "Hello World!";
    }

    public static void main(String[] args) {
        String str = "{\"args\":{\"user\":{\"()\":{\"like\":{\"role->access\":\"duty_plan\"}},\"=>\":[\"id\",\"name\"],\"[]\":1,\"match\":{},\"optional\":{},\"total_page\":true}},\"project_id\":\"crsw\",\"project_type\":\"slab_priv\"}";

    }
}
